<?php
class Form_SearchAccountForm extends Zend_Form
{
	public function __construct($options = null)
	{
		parent::__construct($options);

		$this->setName('SearchAccount')
		->setMethod('post');

		$by_email=new Zend_Form_Element_Text('email');
		$by_email->addFilter('StripTags')
		->setAttrib('style','width:150px;padding:1px;font-size:11px;margin-bottom:8px;')
		->addFilter('StringTrim');
		$this->addElement($by_email);

		 
		//get Department List
        $model_service = new Model_Service();
    	$all_services = $model_service->getAllService();
                
        $departments=array();
        $departments[ '-1' ] = "Any";
        $departments[ '0' ] = "YesUp account";
        foreach($all_services as $key =>$item){
        	$departments[ $item['dpt_id'] ] = $item['dpt_name'];
        }
		//get Department List ends

		$dpt_id=new Zend_Form_Element_Select('dpt_id');
		$dpt_id->addMultiOptions($departments)
		->setAttrib('style','font-size:11px;margin-bottom:10px;height:17px;');
		$this->addElement($dpt_id);
		
		$dpt_account_login=new Zend_Form_Element_Text('dpt_account_login');
    	$dpt_account_login->addFilter('StripTags')
		->setAttrib('style','padding:1px;font-size:11px;margin-bottom:8px;')
    	->addFilter('StringTrim');
    	$this->addElement($dpt_account_login);
		
		$login_area_list=array('any'=>'Any','advertiser'=>'Advertiser','publisher'=>'Publisher','admin'=>'Admin','home'=>'Home');
		$login_area=new Zend_Form_Element_Select('login_area');
		$login_area->addMultiOptions($login_area_list)
		->setAttrib('style','font-size:11px;margin-bottom:10px;height:17px;');
		$this->addElement($login_area);

		$role_list=array('any'=>'Any','manager'=>'Manager','client'=>'Client');
		$role=new Zend_Form_Element_Select('role');
		$role->addMultiOptions($role_list)
		->setAttrib('style','font-size:11px;margin-bottom:10px;height:17px;');
		$this->addElement($role);
		
		$search= new Zend_Form_Element_Submit('search');
		$search->setLabel('Search')
		->setAttrib('style','margin-left:20px;height:22px;padding:2px;cursor:pointer;');
		$this->addElement($search);
		
		foreach($this->getElements() as $element) {
			$element->removeDecorator('HtmlTag');
			$element->removeDecorator('DtDdWrapper');
			$element->removeDecorator('Label');
		}
		
	}

	public function isValid($data)
	{
		$valid = parent::isValid($data);
		return $valid;
	}

}